package org.example.mybatis.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.example.mybatis.model.UserInfo;
@Mapper
public interface DynamicSqlMapper {
    Integer insertUserByCondition(UserInfo userInfo);
    @Insert("<script>" +
            "INSERT INTO userinfo (username,`password`,age," +
            "<if test='gender!=null'>gender,</if>" +
            "phone)" +
            "VALUES(#{username},#{password},#{age}," +
            "<if test='gender!=null'>#{gender},</if>" +
            "#{phone})"+
            "</script>")
    Integer insert(UserInfo userInfo);
    Integer insert2(UserInfo userInfo);
}
